home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
jovept2.arc
/
JOVE.H
< prev
next >
Wrap
Text File
|
1985-05-30
|
8KB
|
362 lines
/* jove.h header file to be included by EVERYONE */
#ifdef UNIX
#include <setjmp.h>
#else
typedef int jmp_buf[10];
#endif
#include "tune.h"
#define EOF -1
#define NULL 0
#define MAXNLINES 66 /* Change it if you want to! */
#define NUMKILLS 10 /* Number of kills saved in the kill ring */
#define NMARKS 16 /* Number of marks in the ring */
#define DIRTY 01
#define MODELINE 02
#define READ 0
#define WRITE 1
#define OKAY 0 /* Return codes for when telling */
#define ABORT 1
#define STOP 2
#define NFUNCS 130
#define NMACROS 52 /* One for each letter???? VI mode for JF */
#define NVARS 20
#define FUNCTION 1
#define VARIABLE 2
#define MACRO 3
#define DEFINE 1
#define EXECUTE 2
#define LBSIZE BUFSIZ /* Same as a logical disk block */
#define ESIZE 128
#define GBSIZE 256
#define RMARGIN 72 /* Default right margin */
#define ARG_CMD 1
#define LINE_CMD 2
#define KILLCMD 3 /* So we can merge kills */
#define YANKCMD 4
#define SCRATCHBUF 1 /* Buffer types */
#define NORMALBUF 2
/* Buffer flags */
#define TEXTFILL 0 /* Text fill mode */
#define OVERWRITE 1 /* Over write mode */
#define CMODE 2 /* C mode */
#define MAGIC 3 /* If set allow pattern matching searching */
#define CASEIND 4 /* Case independent search */
#define MATCHING 5 /* In show matching mode */
#define AUTOIND 6 /* Indent same as previous line after return */
#define NFLAGS 7 /* DO'T FORGET THIS! */
#define FIRSTCALL 0
#define ERROR 1
#define COMPLAIN 2 /* Do the error without a getDOT */
#define QUIT 3 /* Leave this level of recusion */
#define LOGOEXIT 30 /* Sounds like a nice number. Exit non-zero,
* but finish doesn't crash with a core dump.
* Logo checks for non-zero to check to see
* if it should abort the editing */
#define curline curbuf->b_dot
#define curchar curbuf->b_char
#define curmark curbuf->b_markring[curbuf->b_themark]
/* function defs */
#define OnFlag(flags,f) (flags[f] = 1)
#define OffFlag(flags,f) (flags[f] = 0)
#define IsFlagSet(flags,f) (flags[f])
#define Placur(l, c) if (l != CapLine || c != CapCol) DoPlacur(l, c)
#define CTL(c) ('c' & 037)
#define META(c) ('c' | 0200)
#define eolp() (linebuf[curchar] == '\0')
#define bolp() (curchar == 0)
#define lastp(line) (line == curbuf->b_dol)
#define firstp(line) (line == curbuf->b_zero)
#define eobp() (lastp(curline) && eolp())
#define bobp() (firstp(curline) && bolp())
#define HALF(wp) ((wp->w_height - 1) / 2)
#define SIZE(wp) (wp->w_height - 1)
#define makedirty(line) line->l_dline |= DIRTY
#define IsModified(b) (b->b_modified)
#define DoTimes(f, n) exp_p = 1, exp = n, f()
/*----------------------------o.s. dependent------------------------*/
#ifdef UNIX
#define flusho() flushout(-1, &termout)
#endif
/*------------------------------------------------------------------*/
/* This procedure allows redisplay to be aborted if the buffer is
* ready to be flushed, and there are some characters waiting
*/
/*
* C doesn't have a (void) cast, so we have to fake it for lint's sake.
*/
#ifdef lint
#define ignore(a) Ignore((char *) (a))
#define ignorf(a) Ignorf((int (*) ()) (a))
#else
#define ignore(a) a
#define ignorf(a) a
#endif
/* struct defs */
#ifdef UNIX /* unix _iobuf */
struct iobuf {
#ifndef VMUNIX
char *io_ptr;
int io_cnt;
char *io_base;
short io_flag;
char io_file;
#else
int io_cnt;
char *io_ptr;
char *io_base;
int io_bufsiz;
short io_flag;
char io_file;
#endif
};
#endif
struct line {
struct line *l_prev, /* Pointer to prev */
*l_next; /* Pointer to next */
disk_line l_dline; /* Pointer to disk location */
};
struct window {
struct window *w_prev, /* Circular list */
*w_next;
struct buffer *w_bufp; /* Buffer associated with this window */
struct line *w_top, /* The top line */
*w_line; /* The current line */
int w_char,
w_height, /* Height of the window */
w_topnum, /* Line number of the topline */
w_offset, /* Printing offset for the current line */
w_numlines, /* Should we number lines in this window? */
w_dotcol, /* find_pos sets this */
w_dotline, /* UpdateWindow sets this */
w_flags;
};
struct position {
struct line *p_line; /* In the array */
int p_char; /* Char pos */
};
struct mark {
struct line *m_line;
int m_char; /* Char pos of the mark */
struct mark *m_next; /* List of marks */
};
struct buffer {
char *b_name, /* Buffer name */
*b_fname; /* File name associated with buffer */
int b_ino; /* Inode of file name ~~~~~~~~~~~~~~~~ */
struct line *b_zero, /* Pointer to first line in list */
*b_dot, /* Current line */
*b_dol; /* Last line in list */
int b_char; /* Current character in line */
struct mark *b_markring[NMARKS], /* New marks are pushed saved here */
*b_marks; /* All the marks for this buffer */
int b_themark; /* Current mark */
char b_type, /* Scratch? */
b_modified;
int b_flags[NFLAGS];
struct buffer *b_next; /* Next buffer in chain */
};
struct screenline { /* The screen */
char *s_line,
*s_length;
};
struct macro {
int MacLength, /* Length of macro so we can use ^@ */
MacBuflen, /* Memory allocated for it */
Offset, /* Index into body for defining and running */
Flags, /* Defining/running this macro? */
Ntimes; /* Number of times to run this macro */
char *Name, /* Pointer to macro's name */
*Body; /* Actual body of the macro */
};
struct function {
char *f_name;
union {
int (*Func)(); /* This is a built in function */
int *Var; /* Variable */
struct macro *Macro; /* Macro */
} f;
char f_type;
};
typedef struct window WINDOW;
typedef struct position BUFLOC;
typedef struct mark MARK;
typedef struct buffer BUFFER;
typedef struct line LINE;
typedef struct function FUNCT;
typedef struct screenline SCRLNE;
typedef struct macro FMACRO;
typedef int (*FUNC)();
#ifdef UNIX
typedef struct iobuf IOBUF;
#endif
/* globals */
extern int
tabstop,
LastKeyStruck,
UpdMesg,
BufSize,
peekc,
io, /* file desc. */
exp,
exp_p,
this_cmd,
last_cmd,
Input, /* char that is waiting */
InputPending, /* 0 if no char waiting */
killptr,
CanScroll,
Asking, /* 1 if inputting string */
globflags[NFLAGS];
extern char
**argvp,
mesgbuf[100],
linebuf[LBSIZE],
genbuf[LBSIZE];
extern LINE
*killbuf[NUMKILLS]; /* Array of pointers to killed stuff */
extern WINDOW
*fwind, /* first window in list */
*curwind; /* current window */
extern BUFFER
*curbuf; /* Pointer into world for current buffer */
extern struct function
*mainmap[0200],
*pref1map[0200],
*pref2map[0200],
*LastFunc;
#ifdef UNIX
extern IOBUF
termout;
#endif
/* function decl */
extern long lseek();
extern disk_line putline();
extern struct line
*next_line(),
*prev_line(),
*nbufline(),
*reg_delete(),
*lastline(),
*listput();
extern char
*FuncName(),
*filename(),
*getblock(),
*sprintf(),
*strcpy(),
*IOerr(),
*bufmod(),
*index(),
*ask(),
*RunEdit(),
*getline(),
*getblock(),
*malloc(),
*emalloc(),
*place(),
*realloc(),
*getright(),
*getcptr(),
*rindex(),
*sprint(),
*StrIndex();
extern BUFLOC
*dosearch(),
*DoYank(),
*m_paren();
extern MARK *CurMark(),
*MakeMark();
extern WINDOW
*windlook(),
*div_wind();
extern BUFFER
*do_find(),
*do_select(),
*mak_buf(),
*file_exists(),
*buf_exists();
extern int (*Gtchar)();
#ifdef UNIX
extern char *getenv(),
*tgoto(),
*mktemp();
int (*sigset())(); /* Sigset returns a pointer to a procedure */
#endif
#ifndef UNIX
extern FUNC eprefix;
extern FUNC cprefix;
extern FUNC frgt;
#endif
/* end */